<?php

declare(strict_types=1);

namespace Core\Package\ElementPlus\FormCreate\FormItem;

/**
 * 复选框
 * Class Checkbox
 */
class Checkbox extends FormItemAbstract
{
    protected string $_type = 'checkbox';

    protected array $_options = [];

    /**
     * 获取值类型
     * @return string
     */
    public function valueType(): string
    {
        return self::VALUE_TYPE_ARRAY;
    }

    /**
     * Radio constructor.
     * @param string $field
     * @param string $title
     * @param array $value
     */
    public function __construct(string $field, string $title, array $value = [])
    {
        $this->_title = $title;
        $this->_field = $field;
        $this->_value = $value;
        $this->clearable(false);
    }


    /**
     * 设置数据
     * @param array $options
     * @return Checkbox
     */
    public function options(array $options): Checkbox
    {
        $this->_options = $options;
        return $this;
    }
}